package com.utils.SM;

public class Demo {

    public static void main(String[] args) throws Exception {
        final long start = System.currentTimeMillis();
        final String sm3Sign = SM3Utils.sign("{\"name\":\"zhangsan\",\"age\":32}&f80f9e4fceaa40c7890c8c88e11a375a");
        System.out.println(System.currentTimeMillis() - start);
        System.out.println(sm3Sign);
        String encryptedData = "047C5B5F1AD955AC7AFDC04D251E5AA63FB7CECCF5E8401643712185BFBA09854DABCF06B6E8AB12F3F6E28745492F4FAED32EAAE8B43B439B002D4A1FCCE2C19C043EA0F618F354DBB9F0C2EEE2AC2CE773C8A94BC40A688284CFF175BD569955C4308D3C4E92D7FBA176A1F616EB60027DF9FDC61E915AB00611C872D183191BE6251EEBD1E7AA8C1911BBFD16F287AD94C44DA77190198AA0ABBAA7C109C53097AD0F09D6EA3A23E471EE90AE36FB3549DEB0FB0F7F8A1F7E54C8C75E";
        String pri = "86489CD782A2BA5A48F87D5C8C6132053075BA23CBCC199A09C9C2703AA61D79";
        final SM2Utils.SM2KeyPair keyPair = SM2Utils.genSM2KeyPair();
        System.out.println(keyPair.getPublicKeyStr());
        System.out.println(keyPair.getPrivateKeyStr());
        for (int i = 0; i < 10; i++) {
//            final String encrypt = SM2Utils.encrypt("234567达瓦", keyPair.getPublicKeyStr());
//            System.out.println(encrypt);
//            final String decrypt = SM2Utils.decrypt(encrypt, keyPair.getPrivateKeyStr());
//            System.out.println(decrypt);
            final String decrypt = SM2Utils.decrypt(encryptedData, pri);
            System.out.println(decrypt);
        }
    }
}
